import {PureComponent} from "react";
import {Navigate} from "react-router-dom";

export class Login extends PureComponent {
    constructor(props) {
        super(props);
        this.state = {
            isLogin: false,
        }
    }

    onLogin() {
        this.setState({isLogin: true})
    }

    render() {
        const {isLogin} = this.state;
        return (
            <div>
                <h1>登录页面</h1>
                {!isLogin ? <button onClick={() => this.onLogin()}>登录</button> : <Navigate to='/home'/>}
            </div>
        )
    }
}